package com.grm.task.manager.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.ToString;

/**
 * desc: 后端返回json统一格式封装类
 *
 * @author gaorimao
 * @since 2021-3-13
 */
@Data
@ToString
@AllArgsConstructor
public class Result {
    private int code;
    private String message;
    private Object data;
    private Long total;

    public static Result success() {
	    return new Result(200,"成功！",null,null);
    }

    public static Result success(Object data,Long total) {
        return new Result(200,"成功！",null,null);
    }

    public static Result failed(String message) {
        return new Result(500,message,null,null);
    }

    public static Result failed(int code,String message) {
        return new Result(code,message,null,null);
    }
}
